import Vue from "vue";
import Router from "vue-router";
// import Home from "@/router/home/index";
import ArticleContent from "@/views/home/ArticleContent";
import Article from "@/views/home/ArticleList";
import AppDetail from "@/views/home/AppDetail";
import Login from "@/views/login/Login";

import MyCenter from "@/views/myCenter/MyCenter";

Vue.use(Router);

export default new Router({
  routes: [
    {
        path: "/",
        name: "Home",
        redirect: { name: "Home" },
        component: () => import("@/components/container/ContainerRoot"),
        children: [
          {
            path: "/home",
            name: "Home",
            meta: { title: "首页", redirect: true},
            component: () => import("@/views/test/1")
          }
        ]
    },
   
    {
      path: "/myCenter",
      name: "myCenter",
      component: MyCenter
    },
    {
      path: "/articleContent",
      name: "ArticleContent",
      component: ArticleContent
    },
    {
      path: "/article",
      name: "Article",
      component: Article
    },

    {
      path: "/appDetail",
      name: "AppDetail",
      component: AppDetail
    },
    {
      path: "/login",
      name: "login",
      component: Login
    }
  ],
  // 让打开页面，显示顶部
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition;
    } else {
      return { x: 0, y: 0 };
    }
  }
});
